.TH E1432_AUTO_ZERO 3 E1432
.SH NAME
e1432_auto_zero \- Null out DC offset
.IX e1432_auto_zero(3) 3
.SH SYNOPSIS
.cS
SHORTSIZ16 e1432_auto_zero(E1432ID hw, SHORTSIZ16 ID)
.cE
.SH DESCRIPTION
\fIe1432_auto_zero\fR attempts to null out the DC offset of a single
channel or group of channels.

\fIhw\fR must be the result of a successful call to
\fIe1432_assign_channel_numbers\fR, and specifies the group of
hardware to talk to.

\fIID\fR is either the ID of a group of channels that was obtained with a
call to \fIe1432_create_channel_group\fR, or the ID of a single channel.

For input channels, an auto-zero involves grounding the input
amplifier and measuring the resulting offset voltage.  The measured
offset is saved and used to correct future measurements.  For the
E1432 and E1433 input SCAs, an auto-zero also involves measuring the
amplitude accuracy, and a gain constant is saved and used to correct
future measurements.

For source channels, an auto-zero involves disconnecting the external
connector, programming the source to produce zero volts, and then
measuring the actual voltage produced.  The measured offset is saved
and used to correct future measurements.

For tach channels, an auto-zero is not done.

Doing an auto-zero (for either source or input channels) will abort
any currently-running measurement.  In general, it is better to
auto-zero a group of channels all at once rather than auto-zero the
individual channels separately, because the group auto-zero can do
most of the work in parallel and will therefore not take as long.

When firmware is initially loaded into a module with
\fIe1432_install\fR, all input channels are auto-zeroed, \fBbut source
channels are not\fR.

In general, the best auto-zero results will be obtained if all
parameters for the input or source channel are set up prior to doing
the auto-zero.  For example, if the measurement will use a clock
frequency of 65536 Hz, it is best to auto-zero the channels after
setting the clock frequency to 65536 Hz.  Typically, if an auto-zero
is going to be done, it is done after setting up all parameters but
before starting a measurement with \fIe1432_init_measure\fR.

Doing an auto-zero after changing clock frequency is important for
input channels in the E1432 module, because the gain of the E1432's
ADC varies slightly with clock frequency.  This is less of a problem
for the input channels in an E1433 module.

In a multi-module measurement, it is best to make sure all modules (or
at least all source modules) have stopped running a measurement (using
\fIe1432_reset_measure\fR) before doing an auto-zero.  Otherwise, it
is possible that an auto-zero in one module could cause an active
source in a different module to produce an output signal.

For the E1434 or option 1D4 source channels additional steps are
required before auto-zero if the filter frequency of the anti-alias
digital filter has been changed.  These steps are necessary to get the
correct filter path set up in the source before doing the auto-zero,
so that the auto-zero works correctly.

.IP "1." 5
Set the source output mode to grounded.  This prevents any glitching
at the source BNC, but it causes the source to drive the module's
CALOUT line.
.IP "2." 5
Set the source arm mode to manual, so the source never really starts,
so all we drive onto the CALOUT line is DC.
.IP "3." 5
Set the module to not drive CALOUT onto the VXI sumbus, so we can't
accidentally mess up anyone else's use of the VXI sumbus.
.IP "4." 5
Start and stop a measurement.  This gets the correct signal path
loaded into the source, without glitching the output.
.IP "5." 5
Do the auto-zero.
.IP "6." 5
Restore the sumbus setting, the source output mode, and the arm mode.
.PP

You could do this procedure for all auto-zeros, even when the filter
frequency does not change.  It takes a little longer, though.

.SH EXAMPLE
.cS
/* This code is required when auto-zeroing a source channel, if the
   source filter frequency changes.  Otherwise, all that is
   necessary is to call e1432_auto_zero(hw, group). */

/* Set manual arm, output grounded, sumbus off */
CHECK(e1432_set_arm_mode(hw, group, E1432_MANUAL_ARM));
CHECK(e1432_set_source_output(hw, group, E1432_SOURCE_OUTPUT_GROUNDED));
CHECK(e1432_set_sumbus(hw, group, E1432_SUMBUS_OFF));
/* Start and stop measurement, then auto-zero */
CHECK(e1432_init_measure(hw, group));
CHECK(e1432_reset_measure(hw, group));
CHECK(e1432_auto_zero(hw, group));
/* Restore desired sumbus, output, and arm settings */
CHECK(e1432_set_sumbus(hw, group, E1432_SUMBUS_OFF));
CHECK(e1432_set_source_output(hw, group, E1432_SOURCE_OUTPUT_NORMAL));
CHECK(e1432_set_arm_mode(hw, group, E1432_AUTO_ARM));
.cE
.SH "RESET VALUE"
Not applicable.
.SH "RETURN VALUE"
Return 0 if successful, a (negative) error number otherwise.
